/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Heinz Hernandez
 */
@Entity
@Table(name = "person")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Person.findAll", query = "SELECT p FROM Person p"),
    @NamedQuery(name = "Person.findByPerId", query = "SELECT p FROM Person p WHERE p.perId = :perId"),
    @NamedQuery(name = "Person.findByPerName", query = "SELECT p FROM Person p WHERE p.perName = :perName"),
    @NamedQuery(name = "Person.findByPerLastName", query = "SELECT p FROM Person p WHERE p.perLastName = :perLastName"),
    @NamedQuery(name = "Person.findByPerSsn", query = "SELECT p FROM Person p WHERE p.perSsn = :perSsn"),
    @NamedQuery(name = "Person.findByPerBirthDate", query = "SELECT p FROM Person p WHERE p.perBirthDate = :perBirthDate"),
    @NamedQuery(name = "Person.findByPerBirthPlace", query = "SELECT p FROM Person p WHERE p.perBirthPlace = :perBirthPlace")})
public class Person implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "PER_ID")
    private Long perId;
    @Basic(optional = false)
    @Column(name = "PER_NAME")
    private String perName;
    @Basic(optional = false)
    @Column(name = "PER_LAST_NAME")
    private String perLastName;
    @Basic(optional = false)
    @Column(name = "PER_SSN")
    private String perSsn;
    @Basic(optional = false)
    @Column(name = "PER_BIRTH_DATE")
    @Temporal(TemporalType.DATE)
    private Date perBirthDate;
    @Basic(optional = false)
    @Column(name = "PER_BIRTH_PLACE")
    private String perBirthPlace;
    @OneToMany(mappedBy = "perId")
    private List<Veterinary> veterinaryList;
    @OneToMany(mappedBy = "perId")
    private List<Owner> ownerList;
    @OneToMany(mappedBy = "perId")
    private List<Employee> employeeList;

    public Person() {
    }

    public Person(Long perId) {
        this.perId = perId;
    }

    public Person(Long perId, String perName, String perLastName, String perSsn, Date perBirthDate, String perBirthPlace) {
        this.perId = perId;
        this.perName = perName;
        this.perLastName = perLastName;
        this.perSsn = perSsn;
        this.perBirthDate = perBirthDate;
        this.perBirthPlace = perBirthPlace;
    }

    public Long getPerId() {
        return perId;
    }

    public void setPerId(Long perId) {
        this.perId = perId;
    }

    public String getPerName() {
        return perName;
    }

    public void setPerName(String perName) {
        this.perName = perName;
    }

    public String getPerLastName() {
        return perLastName;
    }

    public void setPerLastName(String perLastName) {
        this.perLastName = perLastName;
    }

    public String getPerSsn() {
        return perSsn;
    }

    public void setPerSsn(String perSsn) {
        this.perSsn = perSsn;
    }

    public Date getPerBirthDate() {
        return perBirthDate;
    }

    public void setPerBirthDate(Date perBirthDate) {
        this.perBirthDate = perBirthDate;
    }

    public String getPerBirthPlace() {
        return perBirthPlace;
    }

    public void setPerBirthPlace(String perBirthPlace) {
        this.perBirthPlace = perBirthPlace;
    }

    @XmlTransient
    public List<Veterinary> getVeterinaryList() {
        return veterinaryList;
    }

    public void setVeterinaryList(List<Veterinary> veterinaryList) {
        this.veterinaryList = veterinaryList;
    }

    @XmlTransient
    public List<Owner> getOwnerList() {
        return ownerList;
    }

    public void setOwnerList(List<Owner> ownerList) {
        this.ownerList = ownerList;
    }

    @XmlTransient
    public List<Employee> getEmployeeList() {
        return employeeList;
    }

    public void setEmployeeList(List<Employee> employeeList) {
        this.employeeList = employeeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (perId != null ? perId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Person)) {
            return false;
        }
        Person other = (Person) object;
        if ((this.perId == null && other.perId != null) || (this.perId != null && !this.perId.equals(other.perId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Person[ perId=" + perId + " ]";
    }
    
}
